{{#packageName}}
    package {{packageName}};
{{/packageName}}

import org.apache.dubbo.common.stream.StreamObserver;
import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;

public interface {{interfaceClassName}} {

    static final String JAVA_SERVICE_NAME = "{{packageName}}.{{serviceName}}";
    static final String SERVICE_NAME = "{{commonPackageName}}.{{serviceName}}";

{{#unaryMethods}}
    {{#javaDoc}}
        {{{javaDoc}}}
    {{/javaDoc}}
    {{outputType}} {{methodName}}({{inputType}} request);

    default CompletableFuture<{{outputType}}> {{methodName}}Async({{inputType}} request){
        return CompletableFuture.completedFuture({{methodName}}(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void {{methodName}}({{inputType}} request, StreamObserver<{{outputType}}> responseObserver){
        {{methodName}}Async(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

{{/unaryMethods}}

{{#serverStreamingMethods}}
    {{#javaDoc}}
        {{{javaDoc}}}
    {{/javaDoc}}
    void {{methodName}}({{inputType}} request, StreamObserver<{{outputType}}> responseObserver);
{{/serverStreamingMethods}}

{{#biStreamingWithoutClientStreamMethods}}
    {{#javaDoc}}
        {{{javaDoc}}}
    {{/javaDoc}}
    StreamObserver<{{inputType}}> {{methodName}}(StreamObserver<{{outputType}}> responseObserver);
{{/biStreamingWithoutClientStreamMethods}}


{{#clientStreamingMethods}}
    {{#javaDoc}}
        {{{javaDoc}}}
    {{/javaDoc}}
    StreamObserver<{{inputType}}> {{methodName}}(StreamObserver<{{outputType}}> responseObserver);
{{/clientStreamingMethods}}

}
